package com.atguigu.search;
/*
* 顺序查找
*
*
* */
public class SeqSearch {
    public static void main(String[] args) {
        int[] arr={1,2,3,7,8,4,5,9};
        int i = seqSearch(arr,5);
        System.out.println(i);
    }
    //顺序查找
    public static  int seqSearch(int[] arr,int val){
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]==val){
                return i;

            }

        }
        return -1;
    }

}
